Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hazel: Run ./configure in a build rule #858

Merged
merged 4 commits into from
May 9, 2019
Merged

Hazel: Run ./configure in a build rule #858

merged 4 commits into from
May 9, 2019

Conversation

aherrmann
Copy link
Member

@aherrmann aherrmann commented May 3, 2019

Some Hackage packages ship with a ./configure script that they require to be run. Hazel used to run this script within the repository rule that sets up the package. In a way this makes sense, repository rules are meant for the configure stage. However, this made it very hard to control what environment the ./configure script would pick up. In particular, it might pick up a different C compiler and set of system libraries than the Bazel build would use later on, e.g. nixpkgs_cc_toolchain or the mingw toolchain included in the GHC bindist on Windows.

This change moves the ./configure step from the repository rule to a dedicated build rule. This immediately allows to build some packages on Windows that previously required custom build definitions. E.g. unix-time and network. Note, network still requires some minor patching. The reason is that network relies on a buildinfo file, which is generated by ./configure and meant to be patched into the packageDescription determined by the cabal file. This can be worked around by instead patching the cabal file to conditionally define the corresponding fields depending on the OS.

This also adds network to the Windows CI.

See also FormationAI/hazel#80

This violates hermeticity, as the ./configure script might pick up a
system compiler, and system libraries, which are later replaced through
library dependencies or cc toolchains.
Running the ./configure script during build improves upon the
hermeticity issues. However, it prevents the use of Cabal buildinfo
files. The network configure script generates such a file that is then
meant to be used to patch the Cabal package definition.

However, we can work around this by instead defining conditional flags
in the network cabal file.
@aherrmann aherrmann requested review from mboes and Profpatsch May 3, 2019 14:51
@mboes mboes merged commit 07486d5 into master May 9, 2019
@mboes mboes deleted the win-configure branch May 9, 2019 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants